With the continuous development of video encoding technologies, inter-frame motion search and compensation technologies can effectively eliminate the time redundancy of video contents, and the encoding efficiency is greatly improved. Motion information is obtained through motion estimation and then transferred to a decoding end, and the decoding end predicts and reconstructs a video image by a motion compensation method. However, as after motion compensation, the proportion of the prediction residual in a code stream significantly decreases and the proportion of motion vector information in the code stream continuously increases, how to effectively compress motion information becomes crucial to further improve the video compression efficiency.
A method for obtaining motion information by reducing the proportion of the motion information in a code stream in a video image encoding and decoding process is provided in the prior art.
Motion vectors are obtained through template matching. Specifically, taking a current block being a macro block in a B frame as an example, as shown in FIG. 1, first, a template TM is constructed around the current block by using reconstruction values, and then motion vectors MV0 and MV1 serving as motion vectors of the current block are obtained by using a template of the same shape as the template TM to perform matching search in a forward reference frame (Ref List0) and a backward reference frame (Ref List1) of the block, and meanwhile, a predicted value of the current block is obtained, and is used for performing prediction residual encoding.
In the implementation of the present application, the inventors find that the prior art at least has the following problem.
A large prediction error is introduced when the motion information is obtained, resulting in a low encoding efficiency of video images.